{% extends "cmr_base.jinja" %}

{% block content %}

<section class="content">
  <div class="container">

    <div class="row">
      <div class="bundle-metadata col-xs-12 col-md-10 col_centered">
        <h1 class="bundle-count">{{ count }} applications</h1>

    <p>{% include "app_bundle_action_bar.jinja" %}</p>
    {%- if show_pdf and not request.user.profile.organization.show_pdf_only %}
        <p><a href="#bundle-pdf">Scroll to PDF</a></p>
    {%- endif %}

        <ol class="app_bundle_list">
          {% for form, letter in forms %}
            <li>
              {%- if not request.user.profile.organization.show_pdf_only %}
              <a href="#application-{{ loop.index }}" class="bundle_list_name">
                {{ form.last_name.get_display_value() }},
                {{ form.first_name.get_display_value() }}
              </a>
              {%- else %}
                {{ form.last_name.get_display_value() }},
                {{ form.first_name.get_display_value() }}
              {%- endif %}
            </li>
          {% endfor %}
        </ol>
        
      </div> 
    </div>

    {%- if not request.user.profile.organization.show_pdf_only %}

    {% for form, declaration_form in forms %}
    <div id="application-{{ loop.index }}" class="row">
      <div class="application-data_display col-xs-12 col-md-10 col_centered">
        <div class="application-loop-id">{{ loop.index }}</div>
        {% include "formation/intake_display.jinja" %}
      </div>
    </div>
    {%- endfor %}
    {%- endif %}

    {%- if show_pdf %}
    <div id="bundle-pdf" class="row">
      <div class="iframe_container col-xs-12 col-md-10 col_centered">
        <iframe class="pdf_inset" src="
          {%- if bundled_pdf_url -%}
            {{ bundled_pdf_url }}
          {%- else -%}
            {{ url_with_ids('intake-pdf_bundle', app_ids) }}
          {%- endif -%}
        " frameborder="0" width="800" height="600">
        </iframe>
      </div>
    </div>
    {%- endif %}
  </div>
</section>
{% endblock content %}